package com.shiro.demo.common;

import org.apache.shiro.SecurityUtils;
import org.apache.shiro.subject.Subject;

public class ShiroUtils {
    public static Subject getSubject(){
        return SecurityUtils.getSubject();
    }

    public static String getUsername(){
        return (String)getSubject().getPrincipal();
    }

    public static String getHost(){
        return getSubject().getSession().getHost();
    }
}
